package com.qclix.inv.xml;

import java.util.Comparator;

/**
 * Compares XMLInvoiceLine based on their index
 */
public class LineIndexComparator implements Comparator<XMLInvoiceLine> {
    @Override
    public int compare(XMLInvoiceLine o1,XMLInvoiceLine o2) {
        if (o1 == null && o2 == null) {
            return 0;
        }
        if (o1 != null && o2 == null) {
            return 1;
        }
        if (o1 == null) {
            return -1;
        }
        return new Integer(o1.getIdx()).compareTo(o2.getIdx());
    }
}
